-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[py] Lint Python with ruff #15811
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[py] Lint Python with ruff #15811
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you need to add --exit-non-zero-on-fix
to check
, and --exit-non-zero-on-format
to format
? We want the CI job to fail if it hits any violations.
Other than that, LGTM
Our CI job runs the format and then checks for |
@p0deje There are some issues that ruff won't auto-fix (like lines that are too long)... so git diff wouldn't see those. You might want to add those args to make sure it fails. |
@cgoldberg Hmm, I assumed that when Ruff cannot fix/format, it would fail with non-zero exit code. At least this is how I read the flag name. Will update. |
I'm not 100% sure what the exit code is when it can't fix... I'd have to try, but I suppose it doesn't hurt to add the flags. |
I did some testing and
For format, there seem to be no cases when it would exit non-zero and not format files. I am going to merge this as-is, we should be safe even w/o the flags. |
Use Ruff directly to format and lint Python source code files.